//
//  RYCell.swift
//  SheYangBigData
//
//  Created by 宋海胜 on 2020/12/31.
//  Copyright © 2020 叁拾叁. All rights reserved.
//


import UIKit

class RYNongchangCell: SYBaseCell {

    fileprivate var nameBgView: UIView = {
        let v: UIView = UIView()
        v.backgroundColor = UIColor(white: 0, alpha: 0.5)
        v.layer.cornerRadius = 15
        return v
    }()
    
    fileprivate var guangBgView: UIView = {
        let v: UIView = UIView()
        v.backgroundColor = UIColor(hex: 0x367FF6)
        v.layer.cornerRadius = 15
        return v
    }()
    
    let nameLb: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor.white
        v.font = 19.autoFontSize()
        return v
    }()
    
    let guangLb: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor.white
        v.font = 14.autoFontSize()
        v.text = "逛农场"
        return v
    }()
    
    let pic: UIImageView = {
        let v: UIImageView = UIImageView()
        
        return v
    }()
    

    public func configureView(model: RYNongchangListModel) {
        nameLb.text = model.name
        if let p = model.imgPath {
            pic.kf.setImage(with: URL(string: IMGIP+p))
        }
    }
    
    override func initViews() {
        
        self.backgroundColor = Constant.bgViewColor
        addSubview(pic)
        nameBgView.addSubview(nameLb)
        guangBgView.addSubview(guangLb)
        pic.addSubview(nameBgView)
        pic.addSubview(guangBgView)
        
        nameLb.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.left.equalToSuperview().offset(autoWidth(12.0))
            make.right.equalToSuperview().offset(autoWidth(-12.0))
            make.height.equalTo(30.0.autoWidth())
        }
        guangLb.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.left.equalToSuperview().offset(autoWidth(12.0))
            make.right.equalToSuperview().offset(autoWidth(-12.0))
            make.height.equalTo(30.0.autoWidth())
        }
        nameBgView.snp.makeConstraints { (make) in
            make.bottom.equalToSuperview().offset(autoWidth(-10.0))
            make.left.equalToSuperview().offset(autoWidth(12.0))
            make.height.equalTo(30.0.autoWidth())
        }
        guangBgView.snp.makeConstraints { (make) in
            make.centerY.equalTo(nameBgView)
            make.right.equalToSuperview().offset(autoWidth(-15.0))
            make.height.equalTo(30.0.autoWidth())
        }
        pic.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(10.0.autoWidth())
            make.left.equalToSuperview().offset(autoWidth(15.0))
            make.right.equalToSuperview().offset(autoWidth(-15.0))
            make.height.equalTo(203.5.autoWidth())
            make.bottom.equalToSuperview()
        }
    }
}


